#include <Point.h>

Point::Point(double x, double y, double z):
  _x(x), _y(y), _z(z) {}

Point Point::lerp(const Point& B, const double& u) const
{
  // Calculamos las coordenadas del vector AB
  double vec_x = B._x - _x;
  double vec_y = B._y - _y;
  double vec_z = B._z - _z;

  // Calculamos el punto sumando A+vec*u
  Point sol(_x + vec_x * u,
            _y + vec_y * u,
            _z + vec_z * u);

  return sol;
}

Point& Point::operator=(const Point& dest)
{
  _x = dest._x;
  _y = dest._y;
  _z = dest._z;

  return *this;
}

Point::operator std::string() const
{
  std::stringstream r;
  r << "(" << _x << ", " << _y << ", " << _z << ")";

  return r.str();
}
